

import VueRouter from 'vue-router'

//引入路由模块
import home from './component/tabbar/home.vue'
import member from './component/tabbar/member.vue'
import shopcar from './component/tabbar/shopcar.vue'
import search from './component/tabbar/search.vue'

//导入home里面的路由
import email from './component/Home/email.vue'
import chat from './component/Home/chat.vue'
import about from './component/Home/about.vue'
import location from './component/Home/location.vue'
import more from './component/Home/more.vue'
import phone from './component/Home/phone.vue'
import trend from './component/Home/trend.vue'
import set from './component/Home/set.vue'

//导入chat的子路由
import unread from './component/chat/unread.vue'
import alreadyRead from './component/chat/alreadyRead.vue'
import unreadInfo from './component/chat/unreadInfo.vue'
import readInfo from './component/chat/readInfo.vue'

//各个详情
import emailInfo from './component/email/emailInfo.vue'

//创建路由对象
const router = new VueRouter({
    routes : [//新建组件 account 和 goodlist
        { path: '/', redirect : '/home'}, //路由重定向，将默认的/路径变成主页 
        { path: '/home' , component : home }, 
        { path: '/member' , component : member },
        { path: '/shopcar' , component : shopcar },
        { path: '/search' , component : search },
        //home里面路由模块
        { path: '/email' , component: email},
        { path: '/chat' , component: chat, //chat子路由
          children :[
              { path : 'unread', component : unread  },
              { path : 'alreadyRead', component :alreadyRead},
          ],redirect:'chat/unread'//在children的后面加一个redirect：'/想要默认展示的子路由名字'
        },
        { path: '/about' , component: about},
        { path: '/location' , component: location},
        { path: '/more' , component: more},
        { path: '/phone' , component: phone},
        { path: '/trend' , component: trend},
        { path: '/set' , component: set},
        //home按钮的按钮详情
        { path: '/email/:id' , component : emailInfo },

        { path : '/chat/unreadInfo/:id', component : unreadInfo },
        { path : '/chat/readInfo/:id', component : readInfo }
    ],
    linkActiveClass : 'mui-active' //覆盖默认的高亮类，原来默认的是 router-link-active
})

export default router